package com.taotao.impl.service;

import com.taotao.api.feign.MemberServiceFeign;
import com.taotao.proxy.FeignClientProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangjin
 * @title: OrderService
 * @projectName sw-opefeign-parent
 * @description:
 * @date 2021/11/14 21:39
 */
@RestController
public class OrderService {
    // @Autowired
    //   private MemberServiceFeign memberServiceFeign;
    //  @Autowired
    // private FeignClientProxy feignClientProxy;
    @Autowired
    private FeignClientProxy feignClientProxy;

    /**
     * 订单调用会员
     *
     * @return
     */
    @GetMapping("/orderToMember")
    public String orderToMember() {
        // feign客户端实现RPC远程调用 订单调用会员服务的接口
//        String result = memberServiceFeign.getUser();
        //MemberServiceFeign memberServiceFeign = feignClientProxy.create(MemberServiceFeign.class);
        // String result = memberServiceFeign.getUser();
        MemberServiceFeign memberServiceFeign = feignClientProxy.create(MemberServiceFeign.class);
        String result = memberServiceFeign.getUser();
        return "我是订单服务，调用会员服务接口返回结果:" + result;
    }


}
